package com.learn.boot.xss.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import java.util.ArrayList;
import java.util.List;

/**
 * xss过滤器配置类
 *
 * @author: MI
 * @email: 448341911@qq.com
 * @createDate: 2023/11/24 22:39
 * @updateUser: MI
 * @updateDate: 2023/11/24 22:39
 * @updateRemark: 修改内容
 * @version: v1.0
 */
@Data
@RefreshScope
@ConfigurationProperties(prefix = XssProperties.PREFIX)
public class XssProperties {

    /**
     * xss配置前缀
     */
    public final static String PREFIX = "mate.xss";
    /**
     * 开启xss
     */
    private Boolean enabled = false;

    /**
     * sql 过滤
     */
    boolean sqlFilter = false;

    /**
     * xss过滤器的名字
     */
    String name = "xssFilter";

    /**
     * xss过滤器需要过滤的路径[过滤所有路径]
     */
    String[] urlPatterns = {"/*"};

    /**
     * 过滤器的优先级，值越小优先级越高
     */
    int order = 0;
    /**
     * 放行url
     */
    private List<String> skipUrl = new ArrayList<>();

}
